//
//  UIView+HUD.m
//  FSH5Pay
//
//  Created by 付森 on 2021/7/21.
//

#import "UIView+HUD.h"
#import "MBProgressHUD.h"



@implementation UIView (HUD)

- (void)showToast:(NSString *)toast
{
    [self showToast:toast duration:1];
}

- (void)showToast:(NSString *)toast duration:(double)duration
{
    MBProgressHUD *hud = [MBProgressHUD HUDForView:self];
    if (hud == nil) {
        hud = [MBProgressHUD showHUDAddedTo:self animated:YES];
    }
    hud.mode = MBProgressHUDModeText;
    hud.label.text = toast;
    [hud hideAnimated:YES afterDelay:duration];
}

@end
